<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>账目列表 - 【妖精猫】后台</title>
<meta name="author" content="frankie" />

<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/list.js"></script>
<script type="text/javascript" src="${base}/resources/admin/datePicker/WdatePicker.js"></script>

<script type="text/javascript">
$().ready(function() {

	var $storeSelect = $("#storeSelect");
	var $storeOption = $("#storeOption a");
	var $storeId = $("#storeId");
	
	var $statusSelect = $("#statusSelect");
	var $statusOption = $("#statusOption a");
	var $orderStatus = $("#orderStatus");
	
	var $operatorSelect = $("#operatorSelect");
	var $operatorOption = $("#operatorOption a");
	var $operator = $("#operator");
	
	// 店铺id
	$storeSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击店铺id
	$storeOption.click( function() {
		var $this = $(this);
		$storeId.val($this.attr("val"));
		$this.parents(".popupMenu").hide();
		$("#currentStore").html($this.text());
		$storeOption.removeClass("current");
		$this.addClass("current");
		return false;
	});
	
	// 订单状态
	$statusSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击订单状态
	$statusOption.click( function() {
		var $this = $(this);
		$orderStatus.val($this.attr("val"));
		$this.parents(".popupMenu").hide();
		$("#currentStatus").html($this.text());
		$statusOption.removeClass("current");
		$this.addClass("current");
		return false;
	});
	
	// 操作者
	$operatorSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击操作者
	$operatorOption.click( function() {
		var $this = $(this);
		$operator.val($this.attr("val"));
		$this.parents(".popupMenu").hide();
		$("#currentOperator").html($this.text());
		$operatorOption.removeClass("current");
		$this.addClass("current");
		return false;
	});
	
	[@flash_message /]

});
</script>
</head>
<body>
	<div class="path">
		<a href="${base}/admin/common/index.jhtml">${message("admin.path.index")}</a>
		[#if label]
		&raquo; <a href="${base}/admin/shua/statistics.jhtml">刷单统计 </a><span>(${message("admin.page.total", page.total)})</span>
		[#else]
		&raquo; <a href="${base}/admin/accounts/statistics.jhtml">账目统计 </a><span>(${message("admin.page.total", page.total)})</span>
		[/#if]
		 <span>总计<span style="color:red;"> ${count} </span>笔，共 <span style="color:red;"> ${sum} </span>元</span>
		 [#if !label] <span>佣金共<span style="color:red;"> ${commission} </span>元[/#if]]
	</div>
	<form id="listForm" action="statistics.jhtml" method="get">
		
		[#if label]
		<div class="bar">
			<div class="buttonWrap">
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>${message("admin.common.refresh")}
				</a>
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
						${message("admin.page.pageSize")}<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="pageSizeOption">
							<li>
								<a href="javascript:;"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			
			<div class="buttonWrap">
				<input type="hidden" value="${page.pageable.storeId}" id="storeId" name="storeId">
				<div class="menuWrap">
					<a href="javascript:;" id="storeSelect" class="button">
						<span id="currentStore">[#if page.pageable.storeId == '']店铺名称[#elseif page.pageable.storeId == 1]贾斯特曼[#elseif page.pageable.storeId == 2]真丶性情[#elseif page.pageable.storeId == 3]真性情商城[#elseif page.pageable.storeId == 4]胡佩刚[/#if]</span>
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="storeOption">
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == ''] class="current"[/#if] val="">店铺(all)</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '1'] class="current"[/#if] val="1">贾斯特曼</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '2'] class="current"[/#if] val="2">真丶性情</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '3'] class="current"[/#if] val="3">真性情商城</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '4'] class="current"[/#if] val="4">胡佩刚</a>
							</li>
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.operator}" id="operator" name="operator">
				<div class="menuWrap">
					<a href="javascript:;" id="operatorSelect" class="button">
						<span id="currentOperator">[#if page.pageable.operator == '']操作者[#else]${page.pageable.operator}[/#if]</span>
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="operatorOption">
							<li>
								<a href="javascript:;"[#if page.pageable.operator == ''] class="current"[/#if] val="">操作者(all)</a>
							</li>
							[#list admins as admin]
							<li>
								<a href="javascript:;"[#if page.pageable.operator == admin] class="current"[/#if] val="${admin}">${admin}</a>
							</li>
							[/#list]
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.orderStatus}" id="orderStatus" name="orderStatus">
				<div class="menuWrap">
					<a href="javascript:;" id="statusSelect" class="button">
						<span id="currentStatus">[#if page.pageable.orderStatus == '']订单状态[#elseif page.pageable.orderStatus == 1]已付款[#elseif page.pageable.orderStatus == 2]未付款[/#if]</span>
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="statusOption">
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == ''] class="current"[/#if] val="">状态(all)</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '1'] class="current"[/#if] val="1">已付款</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '2'] class="current"[/#if] val="2">未付款</a>
							</li>
						</ul>
					</div>
				</div>
				
				<div class="menuWrap" style="height: 28px;line-height: 28px;padding-left: 10px;float:left;">开始时间：<input type="text" id="beginDate" name="beginDate" class="text Wdate" value="[#if page.pageable.beginDate??]${page.pageable.beginDate?string("yyyy-MM-dd")}[/#if]" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'endDate\')}'});" /></div>
				<div class="menuWrap" style="height: 28px;line-height: 28px;padding-left: 10px;float:left;">结束时间：<input type="text" id="endDate" name="endDate" class="text Wdate" value="[#if page.pageable.endDate??]${page.pageable.endDate?string("yyyy-MM-dd")}[/#if]" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'beginDate\')}'});" /></div>
				<div class="menuWrap" style="height: 28px;line-height: 28px;padding-left: 10px;float:left;"><input type="submit" value="提交"></div>
				
			</div>
		</div>
		
		<table id="listTable" class="list">
			<tr>
				<th>
					<span>ID</span>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="userName">用户名</a>
				</th>
				<th>
					<span>手机号码</span>
				</th>
				<th>
					<span>金额</span>
				</th>
				<th>
					<span>店铺</span>
				</th>
				<th>
					<span>类型</span>
				</th>
				<th>
					<span>状态</span>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="orderTime">下单时间</a>
				</th>
				<th>
					<span>来源</span>
				</th>
				<th>
					<span>操作者</span>
				</th>
			</tr>
			[#list page.content as item]
				<tr>
					<td>
						<span>${item.id}</span>
					</td>
					<td>
						<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=${item.userName}&siteid=cntaobao&status=1&charset=utf-8">
							<img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=${item.userName}&site=cntaobao&s=1&charset=utf-8" alt="点这里给我发消息" />
							&nbsp;<span title="${item.goodsTitle}">${item.userName}</span>
						</a>
					</td>
					<td>
						<span>${item.mobileNumber}</span>
					</td>	
					<td>
						<span>${currency(item.realPaidFee, true)}</span>
					</td>
					<td>
						<span>[#if item.storeId == 1]贾斯特曼[#elseif item.storeId == 2]真丶性情[#elseif item.storeId == 3]真性情商城[#elseif item.storeId == 4]胡佩刚[/#if]</span>
					</td>
					<td>
						[#if item.type == 1]<span style="color:green;">真实[#elseif item.type == 2]<span style="color:red;">人工[/#if]</span>
					</td>
					<td>
						[#if item.status == 0]<span style="color:green;">未付款[#elseif item.status == 1]<span style="color:blue;">正常[#elseif item.status == 3]<span style="color:red;">已关闭[/#if]</span>
					</td>
					<td>
						<span title="${item.orderTime?string("yyyy-MM-dd")}">${item.orderTime}</span>
					</td>
					<td>
						[#if item.isMobile]<span style="color:green;">手机订单[#else]<span style="color:blue;">PC订单[/#if]</span>
					</td>
					<td>
						<span>${item.operator}</span>
					</td>
				</tr>
			[/#list]
		</table>
		
		[#else]
		
		<div class="bar">
			<div class="buttonWrap">
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>${message("admin.common.refresh")}
				</a>
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
						${message("admin.page.pageSize")}<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="pageSizeOption">
							<li>
								<a href="javascript:;"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			
			<div class="buttonWrap">
				<input type="hidden" value="${page.pageable.storeId}" id="storeId" name="storeId">
				<div class="menuWrap">
					<a href="javascript:;" id="storeSelect" class="button">
						<span id="currentStore">[#if page.pageable.storeId == '']店铺名称[#elseif page.pageable.storeId == 1]贾斯特曼[#elseif page.pageable.storeId == 2]真丶性情[#elseif page.pageable.storeId == 3]真性情商城[#elseif page.pageable.storeId == 4]胡佩刚[/#if]</span>
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="storeOption">
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == ''] class="current"[/#if] val="">店铺(all)</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '1'] class="current"[/#if] val="1">贾斯特曼</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '2'] class="current"[/#if] val="2">真丶性情</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '3'] class="current"[/#if] val="3">真性情商城</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '4'] class="current"[/#if] val="4">胡佩刚</a>
							</li>
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.operator}" id="operator" name="operator">
				<div class="menuWrap">
					<a href="javascript:;" id="operatorSelect" class="button">
						<span id="currentOperator">[#if page.pageable.operator == '']操作者[#else]${page.pageable.operator}[/#if]</span>
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="operatorOption">
							<li>
								<a href="javascript:;"[#if page.pageable.operator == ''] class="current"[/#if] val="">操作者(all)</a>
							</li>
							[#list admins as admin]
							<li>
								<a href="javascript:;"[#if page.pageable.operator == admin] class="current"[/#if] val="${admin}">${admin}</a>
							</li>
							[/#list]
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.orderStatus}" id="orderStatus" name="orderStatus">
				<div class="menuWrap">
					<a href="javascript:;" id="statusSelect" class="button">
						<span id="currentStatus">[#if page.pageable.orderStatus == '']订单状态[#elseif page.pageable.orderStatus == 0]初始化[#elseif page.pageable.orderStatus == 1]已处理[#elseif page.pageable.orderStatus == 2]已失败[/#if]</span>
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="statusOption">
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == ''] class="current"[/#if] val="">状态(all)</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '0'] class="current"[/#if] val="0">初始化</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '1'] class="current"[/#if] val="1">已处理</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '2'] class="current"[/#if] val="2">已失败</a>
							</li>
						</ul>
					</div>
				</div>
				
				<div class="menuWrap" style="height: 28px;line-height: 28px;padding-left: 10px;float:left;">开始时间：<input type="text" id="beginDate" name="beginDate" class="text Wdate" value="[#if page.pageable.beginDate??]${page.pageable.beginDate?string("yyyy-MM-dd")}[/#if]" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'endDate\')}'});" /></div>
				<div class="menuWrap" style="height: 28px;line-height: 28px;padding-left: 10px;float:left;">结束时间：<input type="text" id="endDate" name="endDate" class="text Wdate" value="[#if page.pageable.endDate??]${page.pageable.endDate?string("yyyy-MM-dd")}[/#if]" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'beginDate\')}'});" /></div>
				<div class="menuWrap" style="height: 28px;line-height: 28px;padding-left: 10px;float:left;"><input type="submit" value="提交"></div>
				
			</div>
		</div>
		
		<table id="listTable" class="list">
			<tr>
				[#if editPermission == "ok"]
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
				[/#if]
				<th>
					<a href="javascript:;" class="sort" name="name">用户名</a>
				</th>
				<th>
					<span>关键字</span>
				</th>
				<th>
					<span>金额</span>
				</th>
				<th>
					<span>佣金</span>
				</th>
				<th>
					<span>店铺</span>
				</th>
				<th>
					<span>平台</span>
				</th>
				<th>
					<span>昵称</span>
				</th>
				<th>
					<span>QQ</span>
				</th>
				<th>
					<span>状态</span>
				</th>
				<th>
					<span>操作人</span>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="createDate">操作时间</a>
				</th>
				[#if editPermission == "ok"]
				<th>
					<span>操作</span>
				</th>
				[/#if]
			</tr>
			[#list page.content as item]
				<tr>
					[#if editPermission == "ok"]
					<td>
						<input type="checkbox" name="ids" value="${item.id}" />
					</td>
					[/#if]
					<td>
						<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=${item.name}&siteid=cntaobao&status=1&charset=utf-8">
							<img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=${item.name}&site=cntaobao&s=1&charset=utf-8" alt="点这里给我发消息" />
							&nbsp;<span>${item.name}</span>
						</a>
					</td>	
					<td>
						<span>${item.keyword}</span>
					</td>
					<td>
						<span>${currency(item.sum, true)}</span>
					</td>
					<td>
						<span>${currency(item.commission, true)}</span>
					</td>
					<td>
						<span>[#if item.storeId == 1]贾斯特曼[#elseif item.storeId == 2]真丶性情[#elseif item.storeId == 3]真性情商城[#elseif item.storeId == 4]胡佩刚[/#if]</span>
					</td>
					<td>
						<span>${item.platform}</span>
					</td>
					<td>
						<span>${item.fromNick}</span>
					</td>
					<td>
						<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=${item.qq}&site=qq&menu=yes">
							<img border="0" src="http://wpa.qq.com/pa?p=2:${item.qq}:51" alt="点击这里给我发消息" title="点击这里给我发消息"/>
							&nbsp;<span>${item.qq}</span>
						</a>
					</td>
					<td>
						[#if item.status == 0]<span style="color:green;">初始化[#elseif item.status == 1]<span style="color:blue;">已处理[#elseif item.status == 2]<span style="color:red;" title="${item.memo}">失败[/#if]</span>
					</td>
					<td>
						<span>${item.operator}</span>
					</td>
					<td>
						<span title="${item.createDate?string("yyyy-MM-dd")}">${item.createDate}</span>
					</td>
					[#if editPermission == "ok"]
					<td>
						<a href="edit.jhtml?id=${item.id}">[编辑]</a>
					</td>
					[/#if]
				</tr>
			[/#list]
		</table>
		[/#if]
		
		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
			[#include "/admin/include/pagination.ftl"]
		[/@pagination]
	</form>
</body>
</html>